package com.example.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

    private EditText Username;
    private EditText Password;
    private Button Btn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Log.i("MainActivity", "调用onCreate()");
        Username = (EditText)findViewById(R.id.username);
        Password = (EditText)findViewById(R.id.password);
        Btn = (Button)findViewById(R.id.button);
        Btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, ShowActivity.class);
                intent.putExtra("username", Username.getText().toString());
                intent.putExtra("password", Password.getText().toString());
                startActivity(intent);
            }
        });
    }

    @Override
    protected void onStart(){
        super.onStart();
        Log.i("MainActivity", "调用onStart()");
    }

    @Override
    protected void onResume(){
        super.onResume();
        Log.i("MainActivity", "调用onResume()");
    }

    @Override
    protected void onPause(){
        super.onPause();
        Log.i("MainActivity", "调用onPause()");
    }

    @Override
    protected void onStop(){
        super.onStop();
        Log.i("MainActivity", "调用onStop()");
    }

    @Override
    protected void onRestart(){
        super.onRestart();
        Log.i("MainActivity", "调用onRestart()");
    }

    @Override
    protected void onDestroy(){
        super.onDestroy();
        Log.i("MainActivity", "调用onDestroy()");
    }
}
